/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.artezio.buyndrive.dao.impl;

import com.artezio.buyndrive.dao.UserDAO;
import com.artezio.buyndrive.domain.Country;
import com.artezio.buyndrive.domain.Users;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 *
 * @author vgordievich
 */
@Repository
public class UserDAOImpl extends AbstractHibernateDao<Users>
        implements UserDAO {

    @Autowired
    private SessionFactory sessionFactory;

    public UserDAOImpl() {
        super.setSessionFactory(sessionFactory);
    }

    @Override
    public Users getUser(String email) {
        return (Users) sessionFactory.getCurrentSession()
				.createCriteria(Users.class).add(Restrictions.eq("email", email))
				.uniqueResult();

    }
}
